<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Post extends Default_Controller{
	
	public function __construct(){
		parent::__construct();
		$this->_layout = "templates/default/layout";
		$this->load->model("Posts_Model");
		$thongbaomoi = $this->Posts_Model->getPostTop(1,6);
		$this->loadSidebar("thongbaomoi",$thongbaomoi);
		
		$tintucmoi = $this->Posts_Model->getPostTop(1,3);
		$this->loadSidebar("tintucmoi",$tintucmoi);
		$this->loadSidebar("fanpage");
	}
	public function index(){
		$this->headTitle("Truyền hình cáp Đồng Tháp");		
		$this->loaddata("news_hot",$this->Posts_Model->getPostTop(1,6));
		$this->loaddata("news_hot_1",$this->Posts_Model->getPostTop(1,6));
		//var_dump($this->Posts_Model->getPostTop(1,6)); die;
		$this->loadView('default/index');
	}
	public function detail(){
		
		$id = $this->input->get("id",true);
		$this->load->model("Posts_Model");
		$detailpost = $this->Posts_Model->getPostByPostId($id);
		$this->headTitle($detailpost->Title_vn);
		$this->loaddata("detailpost",$detailpost);
		$this->loadBreadcrumb("Trang chu",base_url());
		$this->loadBreadcrumb("Tin tức",base_url("post"));
		$this->loadBreadcrumb($detailpost->Title_vn);
		
		
		$this->loadView('default/post/detail');
	}
}